package org.ttitfly.ttcore.displaytag;

import org.apache.commons.beanutils.PropertyUtils;
import org.displaytag.decorator.TableDecorator;

public class RowControlDecorator extends TableDecorator {
    public String getCustomDisplayRow() {
        return "" + (this.getListIndex() + 1);
    }

    @Override
    public String addRowId() {
        Object rowObject = this.getCurrentRowObject();
        Long id;
        try {
            id = (Long) PropertyUtils.getProperty(rowObject, "id");
        } catch (Exception e) {
            id = new Long(-1);
        }

        String rowNumber = this.tableModel.getId() + "_" + this.getListIndex();

        return rowNumber + "\" onclick=\"toolBarControlOnClick(" + id + ",this)\" ondblclick=\"toolBarControlOnDblClick(" + id
                + ",this)";
    }
}
